import React from 'react'

export default function ComA(props) {
    const {stateA,setStateA,setStateB} = props
    const onButtonClick = () => {
        setStateB(stateA)
    }
    const onRestButtonClick = () => {
        setStateA("A")
    }
    return (
        <div>
            {stateA}
            <button onClick={onButtonClick}>把B变成A</button>
            <button onClick={onRestButtonClick}>把A变成A</button>
        </div>
    )
}
